﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EasyStudy
{
    public static class GlobalSettings
    {
        public static bool SoundOn = true;
        public static string EmailTo = "393618835@qq.com";
        private static bool allowPopup = true;
        private static Dictionary<String, int> delaySeconds = new Dictionary<String, int>();
        public static string title = "Default";

        /// <summary>
        /// 任务延迟
        /// </summary>
        /// <param name="taskId"></param>
        /// <param name="seconds"></param>
        public static void AddDelayItem(String taskId, int seconds) { delaySeconds.Add(taskId, seconds); }
        public static void RemoveDelayItem(String taskId) { delaySeconds.Remove(taskId); }
        public static int GetDelaySeconds(String taskId) 
        {
            if (delaySeconds.ContainsKey(taskId))
            {
                return delaySeconds[taskId];
            }
            else
            {
                return 0;
            }
        }

        public static event EventHandler AllowPopupValueChanged;

        public static bool AllowPopup
        {
            get{ return allowPopup;}
            set{allowPopup = value; GlobalSettings.AllowPopupValueChanged(allowPopup, null);}
        }
    }
}
